package Test07;

//多线程常用方法

/*
public static void yield()出让线程/礼让线程
 */
public class Test07 {
    public static void main(String[] args) {

        MyThread07 t1 = new MyThread07();
        MyThread07 t2 = new MyThread07();

        t1.setName("飞机");
        t2.setName("坦克");

        t1.start();
        t2.start();
    }
}

class MyThread07 extends Thread {

    @Override
    public void run() {
        for (int i = 1; i <= 100; i++) {
            System.out.println(getName() + "@" + i);

            //出让当前CPU的执行权
            Thread.yield();
        }
    }
}
